import axios from "axios"

//获取商品列表
export const getFoods = async (data) => {
    let res = await axios({
        method:"get",
        url:"/api/supplierFoods",
        params:{
            curPage:data.curPage,
            eachPage:data.eachPage,
            name:data.name,
            type:data.type,
            sort:data.sort
        }
    })
    return res.data;
}
//新增商品
export const addFood = async (data) => {
    let res = await axios({
        method:"post",
        url:"/api/supplierFoods/create",
        data
    })
    return res.data;
}
//删除商品
export const removeFood = async (_id) => {
    let res = await axios({
        method:"post",
        url:"/api/supplierFoods/deldate",
        data:{
            _id
        }
    })
    return res.data;
}
//获取单个商品传给更新
export const getFood = async (_id) => {
    let res = await axios({
        method:"get",
        url:`/api/supplierFoods/${_id}`,
      
    })
    return res.data;
}
//更新商品信息
export const updateFoods = async (data) => {
    let res = await axios({
        method:"post",
        url:`/api/supplierFoods/update`,
        data
    })
    return res.data;
}


